﻿using DarazSdk.Models.Request;
using DarazSdk.Models.Result;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DarazSdk.Products
{
    /// <summary>
    /// 产品接口
    /// </summary>
    public class ProductService 
    {

        DarazClient client;

        /// <summary>
        /// 产品接口
        /// </summary>
        public ProductService(DarazClient darazClient)
        {
            client = darazClient;
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task<DarazResult<CreateProductResult>> CreateAsync(ProductRequest request)
        {
            return await client.PostAsync<ProductRequest, CreateProductResult>("CreateProduct", request);
        }

        /// <summary>
        /// 文件上传
        /// </summary>
        /// <param name="fileInfos"></param>
        /// <returns></returns>
        public async Task<DarazResult<ProductUploadImagesResult>> UploadImagesAsync(List<UploadFileInfo> fileInfos)
        {
            return await client.UploadAsync<ProductUploadImagesResult>("UploadImage", fileInfos);
        }
    }
}
